package com.supervision.manage.controller.case

import com.fly.base.common.DataResponse
import com.fly.base.controller.BaseController
import com.supervision.domain.bean.po.CaseEnforcePO
import com.supervision.manage.service.CaseEnforceService
import io.swagger.annotations.Api
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RequestMethod
import org.springframework.web.bind.annotation.RequestParam
import org.springframework.web.bind.annotation.RestController

@RestController
@RequestMapping("manage/1/caseEnforce")
@Api(tags = ["案件"])
class CaseEnforceController : BaseController() {

    @Autowired
    lateinit var caseEnforceService: CaseEnforceService

    @RequestMapping("list", method = [(RequestMethod.GET)])
    fun list(caseEnforcePO: CaseEnforcePO): DataResponse {
        val data = caseEnforceService.getCaseEnforceList(caseEnforcePO)
        return DataResponse.create().putAll(data)
    }

    @RequestMapping("detail", method = [(RequestMethod.GET)])
    fun detail(@RequestParam("id") id: Long): DataResponse {
        val data = caseEnforceService.getCaseEnforceDetail(id)
        return DataResponse.create().putAll(data)
    }

    @RequestMapping("statusUpdate", method = [(RequestMethod.POST)])
    fun remark(@RequestParam id: Long,
               @RequestParam statusProcess: String,
               @RequestParam(defaultValue = "") remark: String): DataResponse {
        caseEnforceService.caseEnforceRemark(id, statusProcess, remark)
        return DataResponse.create()
    }

    @RequestMapping("smsContent", method = [(RequestMethod.GET)])
    fun smsContent(@RequestParam caseId: Long,
                   @RequestParam type: Int): DataResponse {
        val data = caseEnforceService.getSmsContent(caseId, type)
        return DataResponse.create().putAll(data)
    }

}